DX11 ADD VERTEX LAYOUT ELEMENT

Adds a new element to the specified vertex layout.
Elements are added in order and need a DXGI_FORMAT that is basically used to tell what registers
the data will use on the GPU. For our concerns it is enough to consider the format as determining
the size of the data element; you can put any data in there as long as it has the appropriate size.
The semantic name in accordance with the format determines how your shader will represent the value;
for example a SINT format will appear to your shader and vertex buffer as an integer, however a
UNORM format will appear as an unsigned integer on the CPU side and as a normalized float (0..1) on the GPU;
if you are previously familiar with shaders this is the same approach that is commonly used for colour values -
you set a 32-bit DWORD colour with one colour (and an alpha) component per byte on the CPU and your shaders will
interpret it as 4 floats in the range 0..1.
If you want to add a larger data type than fits into a single format (mainly matrices) you can set the same semantic name
but increasing semantic indices for each data fragment of that datatype; the vertex shader can later read it as a single
variable since the registers are ordered side by side for the same semantic name with increasing indices.
For example, to add a float4x4 to your vertex data you would add 4 elements with semantic "MYMATRIX", indices 0 through 4
and the DXGI_FORMAT_R32G32B32A32_FLOAT format. This creates four 4x32-bit float vectors (rows) that added together is identical
to a 4x4 (32-bit) float matrix.

  Syntax
DX11 ADD VERTEX LAYOUT ELEMENT vertLayout, semanticName, [semanticIndex], format
  Parameters
vertLayout
Dword
The vertex layout to add the element to.
semanticName
String
The semantic name that will identify the element's register on the GPU. Things like "TEXCOORD", "NORMAL" and so on. You can also set your own made-up name for user specific data.
[Optional] semanticIndex
Dword
If your vertex layout has more slots of the same semantic type, a number is added to differate between them. The most common use for this is with the "TEXCOORD" semantic. 0 by default.
format
Dword
The format of the data. Can generally be seen to determine the size and type of data (single integer, array of floats, the bit-depth of the float(s) and so on).

  Returns

This function does not return a value.

  See also

VERTEXLAYOUT Functions Menu
DX11 Function Categories